package com.leemon.mall.sys.service.impl;

import com.leemon.mall.sys.model.SysConfig;
import com.leemon.mall.sys.dao.SysConfigMapper;
import com.leemon.mall.sys.service.SysConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统配置信息表 服务实现类
 * </p>
 *
 * @author leemon
 * @since 2019-09-04
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {

    @Autowired
    private SysConfigMapper sysConfigMapper;

    @Override
    public void updateValueByKey(String key, String value) {
        sysConfigMapper.updateValueByKey(key, value);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        sysConfigMapper.deleteBatch(ids);
    }

    @Override
    public String getValue(String key) {
        SysConfig sysConfig = sysConfigMapper.queryByKey(key);
        return sysConfig == null ? null : sysConfig.getParamValue();
    }
}
